package com.xqboss.system.domain.dto;

import com.xqboss.common.core.text.Convert;

import java.math.BigDecimal;

/**
 * @author Trent
 * @date 2023/9/11
 */
public class IntConfigKey implements SysConfigKey<Integer> {

    private final String key;
    private final Integer defaultValue;

    public IntConfigKey(String key){
        this(key, null);
    }

    public IntConfigKey(String key, Integer defaultValue){
        this.key = key;
        this.defaultValue = defaultValue;
    }

    @Override
    public String getKey() {
        return key;
    }

    @Override
    public Integer convertValue(String value) {
        return Convert.toInt(value, defaultValue);
    }
}
